﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework;

namespace Aim2.Weapon.Projectile {
    class Fireball : Projectile {
        static Texture2D spriteTexture;

        public Fireball(Vector2 direction, Vector2 Position, Side side, IObjectContainer owner) {
            this.direction = direction;
            this.owner = owner;
            Scale = 0.2f;
            Depth = 1f;
            frames = 6;
            framesPerSec = 18;
            speed = 10f;
            Rotation = MathHelper.Pi + MathHelper.PiOver2;

            this.side = side;

            if (Position != null)
                this.Position = Position;

            Health = 0.1f;
            CollisionDamage = 15f;

            animatedSprite = new AnimatedSprite(this, frames, framesPerSec);
        }

        public override Side Side() {
            return side;
        }

        public override void Load(ContentManager Content, Viewport viewport) {
            spriteTexture = Content.Load<Texture2D>("Textures/3x2_fireball");
            spriteTexture.Name = "Textures/3x2_fireball";

            layout = spriteTexture.Name.GetLayout();
            height = spriteTexture.Height;
            width = spriteTexture.Width;

        }

        public override void Draw(SpriteBatch spriteBatch) {
            base.Draw(spriteBatch);
            animatedSprite.DrawFrame(spriteBatch, Position, spriteTexture);

        }
    }
}
